package expression;

import common.MCore;

import choco.integer.IntExp;

public class MSumVar extends MBasicExprVar {

	public MSumVar(MCore c) {
		super(c);
	}

	public IntExp intExp() {
		IntExp[] param = new IntExp[getParameters().size()];
		
		for (int i = 0; i < param.length; i++) {
			param[i] = getParameters().get(i).intExp();
		}
		
		return getCore().getProblem().sum(param);
	}

	public String toText() {
		String s = "(+";
		for (MIntExprVar i: getParameters()) {
			s += " " + i.toText();
		}
		s += ")";
		
		return s;
	}

	public MSumVar eval() {
		return this;
	}
}
